﻿namespace InkType.ViewModel

open System
open System.Collections.Generic
open System.IO


[<AutoOpen>]
module Util =
    let inline (|>!) a f = f a; a

    let SavedTypefacesDir = "SavedTypefaces"


module Option =
    let tryGet fallbackValue =
        function
        | Some v -> v
        | None -> fallbackValue

    let ofByRefBool =
        function
        | true, v -> Some v
        | false, _ -> None


module Event =
    let empty<'d, 'a when 'd : delegate<'a, unit> and 'd :> Delegate> =
        { new IEvent<'d, 'a> with
            member x.Subscribe _ =
                { new IDisposable with
                    member x.Dispose () = () }
            member x.AddHandler _ = ()
            member x.RemoveHandler _ = () }


module GlyphMetrics =
    let Height = 200.
    let BaseLineHeight = 40.
    let BorderOverflow = 600.

